<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="css/amazeui.min.css" />
    <link rel="stylesheet" href="css/index_2.css" />
    <link rel="stylesheet" type="text/css" href="css/pageCode.css">
    <title>直推用户排行榜</title>
</head>

<body>
    <!--头部-->
    <header class="am-u">
        <div class="am-u-sm-12 head_nav" style="margin:0;">
            <div class="am-u-sm-2 am-vertical-align">
                <a href="list.html">
                    <img src="img/return@2x.png" class="am-vertical-align-middle" alt="" />
                </a>
            </div>
            <div class="am-u-sm-8 head_text">
                直推用户排行榜
            </div>
            <div class="am-u-sm-2">

            </div>
        </div>
    </header>
    <!--修改密码输入框-->
    <div style="clear:both"></div>
    <div class="am-u" id="list2" style="padding: 10px;">
        <!--			<div class="am-u-sm-12" style="background: #fff;padding: 10px;">
				<div class="am-u-sm-6" style="text-align: left;">
					<img src="img/portrait@2x.png" alt=""  width="50" style="    margin-left: 20px"/>
					<p style="margin: 0;margin-top: 1rem;">18079998666</p>
				</div>
				<div class="am-u-sm-6 jfsj" style="padding: 0;">	
					<p style="font-size: 13px;margin-bottom: 0;">
                                            直推人数<span> 0 &nbsp;&nbsp;</span>
                                            <span>直刷人数 <span style="color: #080276">0</span></span>
					</p>
					<p style="font-size: 13px;margin:0;margin-top: 0.5rem;">
                                            间推人数<span style="color:#B5324E"> 0&nbsp;&nbsp;</span>
                                            <span>直刷人数 <span style="color: #B5324E">0</span></span>
					</p>
                                        <p style="font-size: 15px;margin:0;margin-top: 0.5rem; color:#5D44C9">
                                            单日最高分润<span style="color:#5D44C9"> 0</span>
					</p>
					<p style="font-size: 15px;margin:0;margin-top: 0.5rem;">
                                            累计分润<span style="color:#517E2E"> 99833.11</span>
					</p>
					<p style="font-size: 13px;margin:0;margin-top: 0.5rem;">
                                            下级用户量<span style="color:#E0A36F"> 38</span>
					</p>
				</div>
			</div>-->
    </div>
    <div style="clear: both;"></div>
    <div class="tcdPageCode" style="color: red;text-align: center;"></div>
    <script src="js/jquery-1.11.3.js"></script>
    <script src="js/jquery.page.js"></script>
    <script src="js/loading.js"></script>
    <script>
        var token1 = sessionStorage['token'];
        var method1 = "Distribution|get_rank_list";
        //          第几页
        var p1 = 1;
        //          每页几条数据
        var pagesize1 = 5;
        $.ajax({
            type: 'POST',
            url: "http://www.rice.com/app/api/h5_access",
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            datatype: "JSON",
            data: {
                method: method1,
                token: token1,
                rank_type: 2,
                p: p1,
                pagesize: pagesize1
            },
            success: function (data) {
                var data1 = JSON.parse(data);
                console.log(data1.data);
                if (data1.status === 1) {
                    var html = "";
                    for (var i in data1.data.list) {
                        var hh = data1.data.list[i].reg_time;
                        var date = new Date(hh * 1000);
                        var Y = date.getFullYear() + '-';
                        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
                            1) + '-';
                        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
                        var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
                        var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes());
                        html +=
                            "<div class='am-u-sm-12' style='background: #fff;padding: 10px 0;margin-bottom:5px;'><div class='am-u-sm-5' style='text-align: center;padding:0'><img src='img/portrait@2x.png'  width='50' />";
                        html += "<p style='margin: 0;margin-top: 1rem;'>" + data1.data.list[i].login_name +
                            "</p>";
                        html +=
                            "</div><div class='am-u-sm-7 jfsj' style='padding: 0;'><p style='font-size: 13px;margin-bottom: 0;'>";
                        html += "直推人数 <span>" + data1.data.list[i].one_child_num +
                            "</span> 直刷人数 <span style='color: #080276'>" + data1.data.list[i].one_consumption_num +
                            "</span></p>";
                        html +=
                            "<p style='font-size: 13px;margin:0;margin-top: 0.5rem;'>间推人数 <span style='color:#B5324E'>" +
                            data1.data.list[i].two_child_num + "</span> 间刷人数 <span style='color: #B5324E'>" +
                            data1.data.list[i].two_consumption_num + "</span></p>";
                        html +=
                            "<p style='font-size: 15px;margin:0;margin-top: 0.5rem;'>累计分润 <span style='color:#517E2E'>" +
                            data1.data.list[i].profit_all + "</span></p>";
                        html +=
                            "<p style='font-size: 15px;margin:0;margin-top: 0.5rem; color:#5D44C9'>单日最高分润<span style='color:#5D44C9'>" +
                            data1.data.list[i].profit_day_most + "</span></p>"
                        html +=
                            "<p style='font-size: 13px;margin:0;margin-top: 0.5rem;'>下级用户量 <span style='color:#E0A36F'>" +
                            data1.data.list[i].all_child_num + "</span></p></div></div>";
                    }
                    $("#list2").html(html);
                    var r = data1.data.count;
                    r = Math.ceil(r / pagesize1);
                    $(".tcdPageCode").createPage({
                        pageCount: r,
                        current: 1,
                        backFn: function (pagesize1) {}
                    });
                } else if (Number(data1.status) == 2) {
                    alert(data1.message);
                    window.location.href = "login.html";
                } else {
                    alert(data1.message);
                }
            }
        });
        $(".tcdPageCode").on("click", 'a', function () {
            var h = $(this).html();
            if (h == "下一页") {
                var t = $('.tcdPageCode  span.current').html();
                t = parseInt(t);
                p1 = t + 1;
            } else if (h == "上一页") {
                var t = $('.tcdPageCode  span.current').html();
                t = parseInt(t);
                p1 = t - 1;
            } else {
                h = parseInt(h);
                p1 = h;
            }
            $.ajax({
                type: 'POST',
                url: "http://www.rice.com/app/api/h5_access",
                contentType: "application/x-www-form-urlencoded; charset=utf-8",
                datatype: "JSON",
                data: {
                    method: method1,
                    token: token1,
                    rank_type: 2,
                    p: p1,
                    pagesize: pagesize1
                },
                success: function (data) {
                    var data1 = JSON.parse(data);
                    console.log(data1.data);
                    if (data1.status === 1) {
                        var html = "";
                        for (var i in data1.data.list) {
                            var hh = data1.data.list[i].reg_time;
                            var date = new Date(hh * 1000);
                            var Y = date.getFullYear() + '-';
                            var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
                                1) + '-';
                            var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) +
                                ' ';
                            var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) +
                                ':';
                            var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes());
                            html +=
                                "<div class='am-u-sm-12' style='background: #fff;padding: 10px 0;margin-bottom:5px;'><div class='am-u-sm-5' style='text-align: center;padding:0'><img src='img/portrait@2x.png'  width='50' />";
                            html += "<p style='margin: 0;margin-top: 1rem;'>" + data1.data.list[i].login_name +
                                "</p>";
                            html +=
                                "</div><div class='am-u-sm-7 jfsj' style='padding: 0;'><p style='font-size: 13px;margin-bottom: 0;'>";
                            html += "直推人数 <span>" + data1.data.list[i].one_child_num +
                                "</span> 直刷人数 <span style='color: #080276'>" + data1.data.list[i].one_consumption_num +
                                "</span></p>";
                            html +=
                                "<p style='font-size: 13px;margin:0;margin-top: 0.5rem;'>间推人数 <span style='color:#B5324E'>" +
                                data1.data.list[i].two_child_num +
                                "</span> 间刷人数 <span style='color: #B5324E'>" + data1.data.list[i].two_consumption_num +
                                "</span></p>";
                            html +=
                                "<p style='font-size: 15px;margin:0;margin-top: 0.5rem;'>累计分润 <span style='color:#517E2E'>" +
                                data1.data.list[i].profit_all + "</span></p>";
                            html +=
                                "<p style='font-size: 15px;margin:0;margin-top: 0.5rem; color:#5D44C9'>单日最高分润<span style='color:#5D44C9'>" +
                                data1.data.list[i].profit_day_most + "</span></p>"
                            html +=
                                "<p style='font-size: 13px;margin:0;margin-top: 0.5rem;'>下级用户量 <span style='color:#E0A36F'>" +
                                data1.data.list[i].all_child_num + "</span></p></div></div>";
                        }
                        $("#list2").html(html);
                        var r = data1.data.count;
                        r = Math.ceil(r / pagesize1);
                        $(".tcdPageCode").createPage({
                            pageCount: r,
                            current: p1,
                            backFn: function (pagesize1) {}
                        });
                    } else if (Number(data1.status) == 2) {
                        alert(data1.message);
                        window.location.href = "login.html";
                    } else {
                        alert(data1.message);
                    }
                }
            });
        })
    </script>
</body>

</html>